package com.teaut.dota.hider.repository;

import com.teaut.dota.hider.entity.TenantEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface TenantInfoRepository extends JpaRepository<TenantEntity, Long>, JpaSpecificationExecutor<TenantEntity> {
    @Query("select count(t) from TenantEntity t")
    long countFirstBy();

    @Query("select (count(t) > 0) from TenantEntity t where t.name = :name")
    boolean existsFirstBy(String name);

    @Override
    void deleteById(Long id);
}